/*
 * @Description: 
 * @Author: mmzhang
 * @Date: 2022-03-09 11:28:30
 * @LastEditTime: 2022-11-10 11:41:22
 */
import dt from '@dt/dt'
import ProBuildUnit from '@/biz/option/proBuildUnit'
import ruleOpt from '@/biz/option/rule.js'

function options(_this) {
  let proBuildUnit = new ProBuildUnit()
  let statusList = []
  if (_this.showTab == 'ABLE') {
    statusList = dt.dictInfo().handoverContract
  } else {
    statusList = dt.dictInfo().handoverContract.filter(item => item.dictValue != '10108')
  }

  let arr1 = [
  {
    key: 'status',
    title: '签约状态',
    select: {
      options: statusList,
    }
  }]

  let arr2 = [
  {
    key: 'handoverCode',
    title: '交房单编号',
    input: {},
    placeholder: '请输入交房单编号',
    rules: [
      ruleOpt.check('请输入至少4位交房单编号', (value) => {
        return value && value.length < 4
      })
    ]
  }]

  let arr = [
    {
      key: 'contractCode',
      title: '签约单编号',
      input: {},
      placeholder: '请输入签约单编号',
      rules: [
        ruleOpt.check('请输入至少4位签约单编号', (value) => {
          return value && value.length < 4
        })
      ]
    },
    ...proBuildUnit.options(_this, false, false)
  ]
  if (_this.showTab == 'ABLE') {
    arr.unshift(...arr1)
  } else if (_this.showTab == 'HANDOVER') {
    arr.unshift(...arr1)
    arr.splice(2, 0, ...arr2)
  } else {
    arr.unshift(...arr2)
  }
  return arr
}

export default {
  options
}